<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<link rel="stylesheet" type="text/css" href="/desing/template.css" />

<ui:decorate template="/templates/template.xhtml">

</ui:decorate>

<h:form id="cadastro">
	<p:messages id="messages" showDetail="true" autoUpdate="true"
		closable="true" />
	<p:panelGrid columns="2" style="width: ;">
		<h:outputText value="Tipo Jogo" />
		<h:selectOneMenu value="#{bolaoAction.bolao.tipoDeJogo}">
			<f:selectItems value="#{bolaoAction.tipoDeJogo}" var="tipo"
				itemValue="#{tipo}" itemLabel="#{tipo.label}"></f:selectItems>
		</h:selectOneMenu>
		<h:outputText value="Quantidade Numeros Marcado" />
		<h:inputText id="qtdNumerosMarcados"
			value="#{bolaoAction.bolao.qtdNumeroMarcado}" />
		<h:outputText value="Sequência Obrigatoria" />
		<h:inputText id="seqIgnorada"
			value="#{bolaoAction.bolao.seqObrigatoria}" />
		<h:outputText value="Sequencia Ignorada" />
		<h:inputText id="seqObrigatoria"
			value="#{bolaoAction.bolao.seqIngnorada}" />
		<h:outputLabel value="Data sorteio" />
		<p:calendar pattern="dd/MM/yyyy"
			value="#{bolaoAction.bolao.dtSorteio}" />
		<h:outputLabel value="Quantida de jogos" />
		<h:inputText value="#{bolaoAction.bolao.qtdJogos}" />
		<h:outputLabel value="Quantida de cotas" />
		<h:inputText value="#{bolaoAction.bolao.qtdCotas}" />
		<h:outputLabel value="Valor da cota" />
		<h:inputText value="#{bolaoAction.bolao.valorCota}" />
	</p:panelGrid>
	<h:commandButton value="Cadastrar" action="#{bolaoAction.add}"
		styleClass="ui-state-default ui-corner-top" />

	<p:dataTable id="tbl" var="bolao" value="#{bolaoAction.bolaos}"
		paginatorPosition="bottom"
		paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
		paginator="true" rows="5" style="margin-bottom:20px">
		<p:column headerText="Tipo de Jogo">
			<h:outputText value="#{bolao.tipoDeJogo.label}"></h:outputText>
		</p:column>

		<p:column headerText="QTD M">
			<h:outputText value="#{bolao.qtdNumeroMarcado}"></h:outputText>
		</p:column>
		<p:column headerText="SEQ Obrigatoria">
			<h:outputText value="#{bolao.seqObrigatoria}"></h:outputText>
		</p:column>
		<p:column headerText="SEQ Ignorada">
			<h:outputText value="#{bolao.seqIngnorada}"></h:outputText>
		</p:column>

		<p:column headerText="Dt Sorteio">
			<h:outputText value="#{bolao.dtSorteio}">
				<f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
			</h:outputText>
		</p:column>
		<p:column headerText="QTD de jogos">
			<h:outputText value="#{bolao.qtdJogos}" />
		</p:column>
		<p:column headerText="QTD de Cotas">
			<h:outputText value="#{bolao.qtdCotas}" />
		</p:column>
		<p:column headerText="Valor da Cota">
							R$<h:outputText value="#{bolao.valorCota}" />
		</p:column>
		<p:column headerText="Ação">
			<p:commandButton id="btn_jogos" type="button"
				styleClass="ui-icon ui-icon-search" />
			<p:overlayPanel id="ovr_jogos" for="btn_jogos" hideEffect="fade"
				dynamic="true" style="width:600px">
				<p:dataTable id="tbl_jogos" var="jogo" value="#{bolao.jogos}"
					rows="10" paginator="true">
					<p:column headerText="jogo">
						<h:outputText value="#{jogo}" />
					</p:column>
				</p:dataTable>
			</p:overlayPanel>
		</p:column>
	</p:dataTable>
</h:form>
</html>
